﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using KaraokeManagementDTO;
using System.Data.OleDb;
using System.Data;

namespace KaraokeManagementDAO
{
    public class LoaiKhachHangDAO:DataProvider
    {
        public List<LoaiKhachHangDTO> layDanhSachLoaiKhachHang()
        {
            List<LoaiKhachHangDTO> listLoaiKhachHang = new List<LoaiKhachHangDTO>();

            List<OleDbParameter> para = new List<OleDbParameter>();

            //Câu truy vấn lấy dữ liệu
            String query = "select * from LoaiKhachHang";


            //DataTable
            DataTable dt = new DataTable();
            dt = ExecuteQuery(query, para);

            if (dt.Rows.Count == 0)
                return null;

            foreach (DataRow row in dt.Rows)
            {
                LoaiKhachHangDTO dto = new LoaiKhachHangDTO();
                dto.ID = int.Parse(row["ID"].ToString());
                dto.TenLoaiKhachHang = row["TenLoaiKhachHang"].ToString();
                listLoaiKhachHang.Add(dto);

            }


            return listLoaiKhachHang;
        }
    }
}
